package io.xccit.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.xccit.mapper.IUserMapper;
import io.xccit.pojo.User;
import io.xccit.pojo.dto.UserDTO;
import io.xccit.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements IUserService {
    @Autowired
    IUserMapper mapper;


    @Override
    public List<User> findAll() {
        return mapper.findAll();
    }

    @Override
    public boolean save(User user) {
        return mapper.save(user);
    }

    public Integer update(User user){
        return mapper.update(user);
    }

    @Override
    public Integer delete(Integer id) {
        return mapper.delete(id);
    }

    @Override
    public List<User> pageFind(Integer pageNum, Integer pageSize) {
        return mapper.pageFind(pageNum,pageSize);
    }

    @Override
    public Integer total() {
        return mapper.total();
    }

    @Override
    public List<User> findByUserName(String username) {
        return mapper.findByUserName(username);
    }

    @Override
    public boolean batchDelete(List<Integer> ids) {
        return mapper.batchDelete(ids);
    }

    @Override
    public UserDTO login(UserDTO userDTO) {
        return mapper.login(userDTO);
    }
}
